package com.tuozixuan.camel.contentfilter;

import org.apache.camel.builder.RouteBuilder;
import org.springframework.stereotype.Component;

@Component
public class ContentFilterDemoRoute extends RouteBuilder {

	@Override
	public void configure() {
	    
	    // 使用Processor进行内容过滤  
//	    from("timer:firedOnceTimer?repeatCount=1").setBody().constant("ContentFilterDemo")
//	        .process(new Processor(){
//
//                @Override
//                public void process(Exchange exchange) throws Exception {
//                    String body = exchange.getMessage().getBody(String.class);
//                    // do something with the body
//                    // and replace it back
//                    exchange.getMessage().setBody("After:" + body);
//                    
//                }})
//	        .to("log:ContentFilterDemoLog");
	    
	    // 使用Bean方法进行内容过滤    
//	    from("timer:firedOnceTimer?repeatCount=1").setBody().constant("ContentFilterDemo")
//	           .bean("customContentFilterProcessor", "process")
//	           .to("log:ContentFilterDemoLog");
	       
	       // 使用表达式进行内容过滤
//	       from("timer:firedOnceTimer?repeatCount=1").setBody().constant("ContentFilterDemo")
//	       .setBody().xpath("//foo:bar")
//           .to("log:ContentFilterDemoLog");
	}

}
